<%@page import="cn.com.dhcc.app.core.CoreEnv.CoreInitCtx"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>${appname}</title>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>
<%@ include file="/WEB-INF/view/common/css_js_ztree.jsp"%>
<script type="text/javascript">
function search(form) {
	$(form).appendPagerParaStr();
	return true;
}

var isAdmin = 0;
$(function(){
	$('.tipMe').tooltip({'placement':'top'});
    if(isAdmin == 1){
		var adminHide =$("*[name='notAdminButton']");
		adminHideButton(adminHide);
	} 
});

function adminHideButton(adminHide){
	if(adminHide.length >= 1){
		for(var i=0;i<adminHide.length;i++){
			adminHide[i].style.display = "none";
		}
	}
}

function deleteById(id){
	parent.ui.confirm('确认删除?',function(){
		 $.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/data_mapping/data_mapping_delete.do",
			   data: {id:id},
			   success: function(resp){
				   if(resp.status == '1'){
					   parent.ui.msg(resp.msg, 1);
					   ui.go(_ctx + '/data_mapping/data_mapping_list.do');
				   }else{
					   parent.ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   parent.ui.msg('信息加载错误', 0);
			   }
		}); 
	});	
}

function lockedById(id){
	 parent.ui.confirm('确认停用?',function(){
		 $.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/data_mapping/lock_data_mapping.do",
			   data: {id:id},
			   success: function(resp){
				   if(resp.status == '1'){
					   parent.ui.msg(resp.msg, 1);
					   ui.go(_ctx + '/data_mapping/data_mapping_list.do');
				   }else{
					   parent.ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   parent.ui.msg('信息加载错误', 0);
			   }
		}); 
	});	
}

function unLockedById(id){
	parent.ui.confirm('确认启用?',function(){
		 $.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/data_mapping/unlock_data_mapping.do",
			   data: {id:id},
			   success: function(resp){
				   if(resp.status == '1'){
					   parent.ui.msg(resp.msg, 1);
					   ui.go(_ctx + '/data_mapping/data_mapping_list.do');
				   }else{
					   parent.ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   parent.ui.msg('信息加载错误', 0);
			   }
		}); 
	});	
}
</script>
<body >
	<div class="main-container" id="main-container">
		<div class="main-container-inner">
			<div class="main-content" style="margin-left: 0px;">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb">
						<li><i class="icon-home home-icon"></i>首页</li>
						<li>数据源映射管理 </li>
						<li class="active">列表</li>
					</ul>
				</div>
				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">
							<div class="widget-box">
				  				<div class="widget-header widget-header-flat">
				  					<h5 class="smaller lighter">
										<i class="icon-list"></i> &nbsp;
									</h5>
									<div class="widget-toolbar no-border">
									 <c:if test="${currentUser eq null || currentUser.ext1 eq 1}">
										<a name="notAdminButton"class="btn btn-primary btn-xs" href="${ctx}/data_mapping/data_mapping_add.do" ><i class="icon-plus-sign icon-on-right"></i> 添加&nbsp;&nbsp;</a>
									 </c:if>
									    <a href="#" data-action="collapse"> <i class="icon-chevron-up"></i></a>
									</div>
								</div>
								<div class="widget-body">
									<div class="widget-main">
										<form id="searchForm" class="form-search" action="${ctx}/data_mapping/data_mapping_list.do" method="post" onsubmit="return search(this)">
											<div class="row mg-top12">
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">数据源映射名称</span> <input
															class="form-control" type="text" name="mappingName"
															value="${param.mappingName}" />
													</div>
												</div>
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-btn">
															<button type="submit" class="btn btn-purple btn-sm">
																<i class="icon-search icon-on-right bigger-110"></i> 搜索
															</button>&nbsp;&nbsp;
	
														</span>
													</div>
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>
							<div class="hr hr12 hr-dotted"></div>
							<div class="table-responsive">
								<table class="table table-striped table-bordered table-hover">
									<thead>
										<tr>
											<th class="center">序号</th>
											<th>数据源映射名称</th>
											<th>映射类型</th>
											<th>源端数据源</th>
											<th>目的端数据源</th>
											<th>备注</th>
											<th>更新时间</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
									    <c:forEach var="vo" items="${_data}" varStatus="status">
										<tr>
											<td class="center"> ${status.index + 1}</td>
											<td>${vo.mappingName}</td>	
											<td >${app:ctname("MP_TYPE",vo.mappingType)}</td>							
											<td>${vo.srcDsName}</td>
											<td>${vo.destDsName}</td>
											<td><span class="tipMe" title="${vo.remark}">${app:lmitStrPx(vo.remark,100)}</span></td>
											<td>${app:fmtDate(vo.mtime)}</td>
											<td>
												<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
													<a class="blue" href="${ctx}/data_mapping/data_mapping_get.do?id=${vo.id}" title="查看">
														<i class="icon-zoom-in bigger-130"></i>
													</a>
													<c:if test="${currentUser eq null || currentUser.ext1 eq 1}">
														<a name="notAdminButton" class="green" href="${ctx}/data_mapping/data_mapping_update.do?id=${vo.id}" title="修改">
															<i class="icon-pencil bigger-130"></i>
														</a>
														<a class="red" name="notAdminButton"  href="javascript:void(0)" onclick="deleteById('${vo.id}');" title="删除">
															<i class="icon-trash bigger-130"></i>
														</a>
														<c:choose>
															<c:when test="${'1' eq vo.status}">
																<a name="notAdminButton" class="red tipMe" href="javascript:void(0);" 
																	title="停用" onclick="lockedById('${vo.id}');"> <i
																	class="icon-lock bigger-130"></i> </a>
															</c:when>
															<c:otherwise>
																<a name="notAdminButton" class="green tipMe" href="javascript:void(0);" 
																	title="启用" onclick="unLockedById('${vo.id}');"> <i
																	class="icon-unlock bigger-130"></i> </a>
															</c:otherwise>
														</c:choose>
													</c:if>
												</div>
											</td>
										</tr>
										</c:forEach> 
										
									</tbody>
									
	      							</table>
								<jsp:include page="/WEB-INF/view/common/pg.jsp">
								<jsp:param value="${ctx}/data_mapping/data_mapping_list.do" name="url"/>
								<jsp:param value="${_total}" name="total"/>
								<jsp:param value="${_urlpara}" name="urlpara" />
							    </jsp:include>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	
 <div id="dataInfoGetModal" class="modal fade" role="dialog" tabindex="-1" aria-labelledby="查看" aria-hidden="false" >
	<div class="modal-dialog" style="width: 850px;">
	 <div class="modal-content">
		<div class='widget-header widget-header-small'><h6 class='smaller'> 查看数据源配置信息</h6></div>
		<div id="dataInfoGetDiv"></div>
	 </div>
</div>
</body>
</html>
